package com.legal.aid.common.constant;

import java.util.concurrent.TimeUnit;

/**
 * 缓存的key 常量
 * 
 * @author ruoyi
 */
public class CacheConstants
{
    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY = "login_tokens:";

    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY_APP = "login_tokens_app:";


    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 防重提交 redis key
     */
    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";

    /**
     * 限流 redis key
     */
    public static final String RATE_LIMIT_KEY = "rate_limit:";

    /**
     * 登录账户密码错误次数 redis key
     */
    public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";



    public static final String NEWS_TOP_LIST= "news:top:list:";
    /**
     * 热点新闻Key
     */
    public static final String NEWS_HOT_LIST = "news:hot:list:";


    /**
     * 热点新闻缓存过期时间(10分钟)
     */
    public static final long NEWS_HOT_EXPIRE = 10 * 60;  // 10*60秒
    /**
     * 浏览量计数前缀
     */
    public static final String NEWS_VIEW_COUNT_KEY_PREFIX = "news:view:count:";

    /**
     * 浏览数key 过期时间
     */
    public static final long VIEW_COUNT_EXPIRE_TIME = 24 * 60 * 60;


    // Redis 键前缀

    // 聊天历史默认保存时间（30天）
    public static final String PERSISTED_MESSAGES_KEY = "chat:persisted:";  // 已持久化消息ID
    public static final String CHAT_LIST_KEY ="chat:list:" ;   // 聊天列表
    public static final String UNREAD_COUNT_KEY =  "chat:unread:";  // 未读计数
    public static final String CHAT_HISTORY_KEY =  "chat:history:";   // 聊天历史
    public static final Object HISTORY_EXPIRE_TIME = 30;
    public static final String MESSAGE_ID_KEY = "chat:message:id";  // 消息ID生成器
    public static final TimeUnit HISTORY_EXPIRE_UNIT =  TimeUnit.DAYS;
    public static final String HOT_NEWS_SEARCH_KEYWORDS = "hot:search:news";


    /**
     *  浏览量同步间隔 十分钟
     */
    private static final long NEWS_VIEW_SYNC_INTERVAL = 10 * 60;

    private static final long COMMENT_VIEW_SYNC_INTERVAL = 10 * 60;
    /**
     * 评论点赞
     */
    public static final String COMMENT_LIKE_PREFIX = "comment:like:";
    /**
     * 评论数
     */
    public static final String COMMENT_COUNT_PREFIX = "comment:count:";

    

}

